using System;

namespace WegasManagementSystem.Models
{
    /// <summary>
    /// 用户实体类
    /// </summary>
    public class User
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string Username { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 用户角色
        /// </summary>
        public string UserRole { get; set; }

        /// <summary>
        /// 关联的员工ID
        /// </summary>
        public int? EmpId { get; set; }

        /// <summary>
        /// 账户是否启用
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedTime { get; set; }

        /// <summary>
        /// 关联员工姓名（非数据库字段）
        /// </summary>
        public string EmpName { get; set; }

        /// <summary>
        /// 用户角色对应的中文名称（非数据库字段）
        /// </summary>
        public string RoleName
        {
            get
            {
                switch (UserRole)
                {
                    case "admin":
                        return "系统管理员";
                    case "hr":
                        return "人事管理员";
                    case "finance":
                        return "财务人员";
                    case "staff":
                        return "普通职工";
                    default:
                        return UserRole;
                }
            }
        }

        /// <summary>
        /// 默认构造函数
        /// </summary>
        public User()
        {
            IsActive = true;
            CreatedTime = DateTime.Now;
            UpdatedTime = DateTime.Now;
        }
    }
} 